/*
 * Created on May 29, 2005
 */
package org.vectrics.recruiter.user.resume.email;

import java.io.FileInputStream;
import java.util.Date;
import java.util.Locale;

import org.apache.log4j.Logger;
import org.vectrics.SystemException;
import org.vectrics.common.db.OwnedObject;
import org.vectrics.common.db.RecordObject;
import org.vectrics.common.util.FileUtil;
import org.vectrics.common.util.StringUtils;
import org.vectrics.domain.Domain;
import org.vectrics.provider.CoreServiceLocator;
import org.vectrics.recruiter.RecruitServiceLocator;
import org.vectrics.recruiter.config.RecruitConfig;
import org.vectrics.recruiter.document.CandidateDocument;
import org.vectrics.recruiter.document.CandidateDocumentCategory;
import org.vectrics.recruiter.user.Resume;

/**
 * @author MMoore
 */
public class EmailedResumeAttachment implements RecordObject, OwnedObject {
	
	
	private EmailedResumeInfo emailedResumeInfo = null;
	private Long id = null;
	private Date dateSaved = null;
	//private CandidateDocumentCategory category = null;
	private Domain domain = null;
	private transient final Logger log = Logger.getLogger(this.getClass());
	private Resume resume = null;
	private CandidateDocument document = null;
	
	protected EmailedResumeAttachment() {
		super();
	}
	
	public boolean getIsEmailedBody() {
		return(StringUtils.isNullOrBlank(this.document.getOriginalFileName()));
	}
	
	/**
	 * @return Returns the emailedResumeInfo.
	 */
	public EmailedResumeInfo getEmailedResumeInfo() {
		return emailedResumeInfo;
	}
	/**
	 * @param emailedResumeInfo The emailedResumeInfo to set.
	 */
	public void setEmailedResumeInfo(EmailedResumeInfo emailedResumeInfo) {
		this.emailedResumeInfo = emailedResumeInfo;
	}
	/**
	 * @return Returns the dateSaved.
	 */
	public Date getDateSaved() {
		return dateSaved;
	}
	/**
	 * @param dateSaved The dateSaved to set.
	 */
	public void setDateSaved(Date dateSaved) {
		this.dateSaved = dateSaved;
	}
	/**
	 * @return Returns the id.
	 */
	public Long getId() {
		return id;
	}
	/**
	 * @param id The id to set.
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return Returns the domain.
	 */
	public Domain getDomain() {
		return domain;
	}

	/**
	 * @param domain The domain to set.
	 */
	public void setDomain(Domain domain) {
		this.domain = domain;
	}


	/**
	 * @return Returns the document.
	 */
	public CandidateDocument getDocument() {
		return document;
	}

	/**
	 * @param document The document to set.
	 */
	public void setDocument(CandidateDocument document) {
		this.document = document;
	}

	/**
	 * @return Returns the resume.
	 */
	public Resume getResume() {
		return resume;
	}




	/**
	 * @param resume The resume to set.
	 */
	public void setResume(Resume resume) {
		this.resume = resume;
	}
	

	public String getFileExtention() {
		String extension = FileUtil.findFileExtention(this.getDocument().getSavedFileName());
		return(extension);
	}
}
